package aspectj.concert;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;

/**
 * 用于演示环绕通知的切面类
 */
@Aspect
@Component
@Profile("around")
public class AudienceAround {

    @Around("execution(** concert.Performance.perform(..))") //通知方法会将目标方法封装起来
    public void watchPerformance(ProceedingJoinPoint joinPoint) {
        try {
            System.out.println("Before....");
            joinPoint.proceed(); //调用被通知的方法，可对它进行多次调用
            System.out.println("After....");
        } catch (Throwable e) {
            System.out.println("Throwable....");
        }

    }


}
